<template>
  <main class="wss-container">
    <!-- 合同编辑不能看编辑中心的内容 -->
    <ComTabs
      @EventSelectTab="currentSelect"
      :activeName="activeName"
      :tabList="isEditLook() ? tabListNoEdit:tabList"
    ></ComTabs>
    <Contract v-if="activeName == 'contract'"></Contract>
    <EditCenter v-if="activeName == 'editCenter'"></EditCenter>
    <contractTmp v-else-if="activeName == 'contractTmp'"></contractTmp>
    <InStock v-else-if="activeName == 'inStock'"></InStock>
  </main>
</template>

<script>
import ComTabs from "@/wss/components/ComTabs.vue";
import EditCenter from './editCenter/index.vue'
import contractTmp from './contractTmp/index.vue'
import Contract from './contractTmp/contract.vue'
import InStock from './inStock/index.vue'

export default {
    components:{EditCenter,contractTmp,ComTabs,Contract,InStock},
    data() {
        return {
            activeName: "contract",
            // tab页数据
            tabList: [
              {
                  label: "合同模板",
                  name: "contract",
              },
              {
                  label: "编辑中心",
                  name: "editCenter",
              },
              {
                  label: "入库管理",
                  name: "inStock",
              },
            ],
            // 合同编辑不能看编辑中心的内容
            tabListNoEdit: [
              {
                  label: "合同模板",
                  name: "contract",
              },
            ],
        };
    },
    methods: {
        currentSelect({ label, index, name }) {
            this.activeName = name;
        },

        // 合同编辑不能看编辑中心的内容
        isEditLook(){
          let roles = this.$store.state.user.roles
          if(roles.includes('htbj')){
            return true
          }else{
            return false
          }
        },
    },
}
</script>

<style scoped>
/* .wss-container{
  display: flex;
  flex-direction: column;
  overflow: initial;
}
.wss-container .el-tabs{
  height: 40px;
  margin-bottom: 20px;
} */
.wss-container{
  display: flex;
  flex-direction: column;
}
.wss-container .tab-box{
  height: 40px;
  margin-bottom: 20px;
}
.wss-container .main-box {
  height: calc(100% - 60px);
}
</style>